package br.com.lavitstudio.game;

import java.util.Random;

public class level_Mountains {
	private Block[][] block;
	
	public level_Mountains(Block[][] block) {
		this.block = block;
	}
	
	public void generateLevel() {
		for(int y=0;y<block.length;y++) {
			for(int x=0; x<block[0].length; x++) {
				if(y > Level.worldH / 6) {
					if(new Random().nextInt(100) > 20){
						try {
							if(block[x-1][y-1].id == Tile.block.get("earth")){
								block[x][y].id = Tile.block.get("earth");
							}
						} catch(Exception e) { }
					}
					
					if(new Random().nextInt(100) > 30){
						try {
							if(block[x+1][y-1].id == Tile.block.get("earth")){
								block[x][y].id = Tile.block.get("earth");
							}
						} catch(Exception e) { }
					}

					try {
						if(block[x][y-1].id == Tile.block.get("earth")){
							block[x][y].id = Tile.block.get("earth");
						}
					} catch(Exception e) { }
					
					if(new Random().nextInt(100) < 2) {
						block[x][y].id = Tile.block.get("earth");
					}
				}
			}
		}
	}
}
